#import <Foundation/Foundation.h>
#import <gtk/gtk.h>

int main(int argc,char **argv){
	GtkWidget *w;
	GtkWidget *vbox;
	GtkWidget *toolbar;
	GtkToolItem *new,*open,*save,*sep,*exit;
	gtk_init(&argc,&argv);
	w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	//w = gtk_window_new(GTK_WINDOW_POPUP);
	gtk_window_set_position(GTK_WINDOW(w),GTK_WIN_POS_CENTER);
	gtk_container_set_border_width(GTK_CONTAINER(w),40);
	gtk_window_set_default_size(GTK_WINDOW(w),250,200);
	gtk_window_set_title(GTK_WINDOW(w),"toolbar");

	vbox = gtk_vbox_new(FALSE,0);
	gtk_container_add(GTK_CONTAINER(w),vbox);
	toolbar = gtk_toolbar_new();
	gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),GTK_TOOLBAR_ICONS);
	gtk_container_set_border_width(GTK_CONTAINER(toolbar),2);
	new = gtk_tool_button_new_from_stock(GTK_STOCK_NEW);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar),new,-1);
	open = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar),open,-1);
	save = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar),save,-1);
	sep = gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar),sep,-1);
	exit = gtk_tool_button_new_from_stock(GTK_STOCK_QUIT);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar),exit,-1);

	gtk_box_pack_start(GTK_BOX(vbox),toolbar,FALSE,FALSE,15);
	g_signal_connect(G_OBJECT(exit),"clicked",G_CALLBACK(gtk_main_quit),NULL);
	//g_signal_connect_swapped(G_OBJECT(w),"destroy",G_CALLBACK(gtk_main_quit),NULL);
	g_signal_connect(G_OBJECT(w),"delete_event",G_CALLBACK(gtk_main_quit),NULL);

	gtk_widget_show_all(w);
	gtk_main();

	return 0;
}